#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
inline int read()
{
    int x=0;char ch=getchar();
    while(!isdigit(ch)) ch=getchar();
    while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
    return x;
}
const int N=1e6+10;
bool Begin;
int n,r1[N],r2[N],L[N],R[N];
int st,stk[N];
bool edge[N];
ld Ans,h[N],H[N],ans[N];
bool End;
inline void Max(ld &x,ld y) {x=x>y?x:y;}
inline void Min(ld &x,ld y) {x=x>y?y:x;}
void check(int x,int &res)
{
    int l=1,r=st,mid;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(L[stk[mid]]<=x&&x<=R[stk[mid]]) {res=mid;break;}
        if(L[stk[mid]]<x) r=mid-1;
        else l=mid+1;
    }
    // res=stk[res];
}
ld calc1(int x,int tp) {return H[x]*(tp-L[x])/(R[x]-L[x]);}
ld calc2(int x,int tp) {return h[x]*(tp-r1[x])/(r2[x]-r1[x]);}
ld js(int x,int y)
{
    // assert(r2[y]<=r2[x]);
    return ans[y]+h[y]+h[x]*(r2[x]-r2[y])/(r2[x]-r1[x]);
}
int main()
{
    freopen("wan.in","r",stdin);
    freopen("wan.out","w",stdout);
    cerr<<(&Begin-&End)/1024/1024<<"MB\n";
    n=read();
    for(int i=1;i<=n;i++)
    {
        // if(i==7) return 0;
        // if(i==23) cerr<<"Bom"<<endl;
        // if(!st) assert(i==1);
        // for(int j=1;j<=st;j++)
        //     cout<<L[stk[j]]<<","<<R[stk[j]]<<","<<H[stk[j]]<<" \n"[j==st];
        h[i]=read(),r1[i]=read(),r2[i]=read();
        int res1=0,res2=0;
        check(r1[i],res1),check(r2[i],res2);
        // if(i==5)
        // cerr<<res1<<" "<<res2<<endl;
        if(!res1&&st&&r1[stk[st]]>r1[i]&&h[i]*(r2[stk[st]]-r1[stk[st]])/h[stk[st]]+r1[stk[st]]>r2[i])//完全没有阻碍地放入
        {
            ans[i]=ans[stk[st]];
            L[i]=r1[i],R[i]=r2[i],H[i]=h[i];
            stk[++st]=i;
            if(st)
            {
                L[stk[st]]=R[i];
                // H[stk[st]]=;
            }
            // cerr<<"He"<<endl;
            continue;
        }
        if(!st||r1[i]>r2[stk[1]])//放顶上
        {
            // cerr<<"He"<<endl;
            assert(!res1&&!res2);
            ans[i]=ans[stk[1]]+h[stk[1]];
            L[i]=r1[i],R[i]=r2[i],H[i]=h[i];
            stk[st=1]=i;
            continue;
        }
        // if(i==23) cerr<<"Bom1"<<endl;
        ld h1=res1?ans[stk[res1]]+calc2(stk[res1],r1[i]):ans[stk[st]],h2;
        if(res1) Max(h1,ans[stk[res1]]+h[stk[res1]]-H[stk[res1]]);
        // else h1=ans[stk[st]];
        if(!res2&&st&&r2[stk[1]]<r2[i])//阻力来源为最外层的碗
        {
            // if(i==4) cerr<<"He"<<endl;
            h2=js(i,stk[1]);
            // cerr<<"He "<<h1<<" "<<h2<<endl;
        }
        else
        {
            // if(i==4) cerr<<"He2"<<endl;
            h2=ans[stk[res2]]+calc2(stk[res2],r2[i]);
            // cerr<<"He"<<endl;
            if(res2<st&&js(i,stk[res2+1])>h2) h2=js(i,stk[res2+1]);//阻力来源实际为下面的碗,不用管碗底
        }
        // if(i==23) cerr<<"Bom2"<<endl;
        // if(i==5)
        // cerr<<h1<<" "<<h2<<endl;
        if(h2-h[i]>h1)
        {
            while(st>res2) --st;
            // if(i==7) cerr<<"He "<<st<<endl;
            ans[i]=h2-h[i];
            // if(i==7) cerr<<h[stk[st]]<<" "<<ans[stk[st]]<<endl;
            H[stk[res2]]=ans[stk[res2]]+h[stk[res2]]-h2;
        }
        else
        {
            // cerr<<"Bom"<<endl;
            while(st>res1) --st;
            if(st&&h[i]+h1>=ans[stk[res1]]+h[stk[res1]]) --st,--res1;
            ans[i]=h1;
            if(res1) H[stk[res1]]=ans[stk[res1]]+h[stk[res1]]-(h1+h[i]);
            // return 0;
        }
        // if(i==23) cerr<<"Bom3 "<<st<<endl;
        while(st&&ans[stk[st]]+h[stk[st]]<=ans[i]+h[i]) --st;
        L[i]=r1[i],R[i]=r2[i],H[i]=h[i];
        if(st)
        {
            L[stk[st]]=R[i];
            // H[stk[st]]=;
        }
        // if(i==20) cerr<<"Bom "<<st<<endl;
        stk[++st]=i;
        // if(i==6) return 0;
    }
    // for(int j=1;j<=st;j++)
    //     cout<<L[j]<<","<<R[j]<<","<<H[j]<<" \n"[j==st];
    // for(int i=1;i<=n;i++)
    //     cout<<ans[i]<<" \n"[i==n];
    for(int i=1;i<=n;i++)
        Max(Ans,ans[i]+h[i]);
    printf("%.10Lf\n",Ans);
    return 0;
}